package com.cskaoyan.controller;

import com.cskaoyan.annotation.LogAnnotation;
import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.UserData;
import com.cskaoyan.bean.bo.AdminCreateBO;
import com.cskaoyan.bean.bo.AdminUpdateBO;
import com.cskaoyan.bean.param.BaseParam;
import com.cskaoyan.bean.po.AdminPO;
import com.cskaoyan.bean.vo.AdminListVO;
import com.cskaoyan.service.AdminService;
import com.cskaoyan.service.UserService;
import org.apache.shiro.crypto.SecureRandomNumberGenerator;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("admin/admin")
public class AdminController {
    @Autowired
    AdminService adminService;

    @RequestMapping("list")
    public BaseRespVo list(BaseParam baseParam, String username) {
        AdminListVO adminList = adminService.queryAdmin(baseParam,username);
        return BaseRespVo.ok(adminList);
    }

    @LogAnnotation
    @RequestMapping("create")
    public BaseRespVo create(@RequestBody AdminCreateBO adminCreateBO) {
        return adminService.create(adminCreateBO);
    }
    @LogAnnotation
    @RequestMapping("update")
    public BaseRespVo update(@RequestBody AdminUpdateBO adminUpdateBO) {
        return adminService.update(adminUpdateBO);
    }
    @LogAnnotation
    @RequestMapping("delete")
    public BaseRespVo delete(@RequestBody AdminUpdateBO adminUpdateBO) {
        return adminService.delete(adminUpdateBO);
    }

}
